package day05;

import java.util.Scanner;

public class Balance {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            double yearIncome = sc.nextDouble(); // 年收入
            double startPoint = sc.nextDouble(); // 起征点金额

            if (yearIncome < startPoint) {
                System.out.println("0.00");
            } else {
                double balance = yearIncome - startPoint; // 余额
                // 纳税款
                double tax = calculateTax(balance);
                System.out.printf("%.2f", tax);
            }
        }
    }

    public static double calculateTax(double balance) {
        double tax = 0.0;
        if (balance <= 1500) {
            tax = balance * 0.03;
        } else if (balance <= 4500) {
            tax = 1500 * 0.03 + (balance - 1500) * 0.1;
        } else if (balance <= 9000) {
            tax = 1500 * 0.03 + 3000 * 0.1 + (balance - 4500) * 0.2;
        } else if (balance <= 35000) {
            tax = 1500 * 0.03 + 3000 * 0.1 + 4500 * 0.2 + (balance - 9000) * 0.25;
        } else if (balance <= 55000) {
            tax = 1500 * 0.03 + 3000 * 0.1 + 4500 * 0.2 + 26000 * 0.25 + (balance - 35000) * 0.3;
        } else if (balance <= 80000) {
            tax = 1500 * 0.03 + 3000 * 0.1 + 4500 * 0.2 + 26000 * 0.25 + 20000 * 0.3 + (balance - 55000) * 0.35;
        } else {
            tax = 1500 * 0.03 + 3000 * 0.1 + 4500 * 0.2 + 26000 * 0.25 + 20000 * 0.3 + 25000 * 0.35 + (balance - 80000) * 0.45;
        }
        return tax;
    }
}
